package com.example.pkq;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    private Button button, button1, button2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        button = findViewById(R.id.Calculator_button);
        button1 = findViewById(R.id.button);
        button2 = findViewById(R.id.button1);

        OnClick on = new OnClick();

        button.setOnClickListener(on);
        button1.setOnClickListener(on);
        button2.setOnClickListener(on);
    }

    private class OnClick implements View.OnClickListener {
        Intent intent;
        @Override
        public void onClick(View view) {
            switch (view.getId()) {
                case R.id.Calculator_button:
                    intent = new Intent(MainActivity.this, Calculator.class);
                    break;
                case R.id.button:
                    intent = new Intent(MainActivity.this, LoginActivity.class);
                    break;
                case R.id.button1:
                    intent = new Intent(MainActivity.this, RegisterActivity.class);
                    break;
            }
            startActivity(intent);
        }
    }
}